package com.dmlll.service.impl;

import com.dmlll.VO.PersonalInformationVO;
import com.dmlll.VO.PersonalMessageVO;
import com.dmlll.dao.PersonalMessageMapper;
import com.dmlll.pojo.BaseEntity;
import com.dmlll.pojo.PersonalMessage;
import com.dmlll.service.PersonalMessageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class PersonalMessageServiceImpl implements PersonalMessageService {
    @Autowired
    private PersonalMessageMapper personalMessageMapper;
    @Override
    public Integer addPersonalMessage(PersonalMessage personalMessage) {
        return personalMessageMapper.insertSelective(personalMessage);
    }

    @Override
    public PersonalMessage findPersonalMessageById(Integer id) {
        return personalMessageMapper.selectByPrimaryKey(id);
    }

    @Override
    public Integer updatePersonalInformation(PersonalMessage personalMessage) {
        return personalMessageMapper.updateByPrimaryKeySelective(personalMessage);
    }

    @Override
    public List<PersonalMessageVO> loadPersonalInformation(String search,Integer grade) {
        return personalMessageMapper.selectCheck(search,grade);
    }

    @Override
    public List<PersonalMessage> loadPersonalInformationCheckShow(Integer userId) {
        return personalMessageMapper.selectByUserId(userId);
    }

    @Override
    public Integer check(Integer[] ids, Integer isTrue,String reason,String userAccount) {
        return personalMessageMapper.check(ids,isTrue,reason,userAccount);
    }

    @Override
    public void updateGetPersonalInformation(PersonalMessage personalMessage) {
        personalMessageMapper.updateByPrimaryKeySelective(personalMessage);
    }

    @Override
    public List<BaseEntity> getData(PersonalInformationVO personalInformationVO) {
        return personalMessageMapper.getData(personalInformationVO);
    }


}
